//
//  XYThumbView.m
//  ZhaoQiPei
//
//  Created by 找汽配 on 2017/3/2.
//  Copyright © 2017年 XiangYun. All rights reserved.
//

#import "XYRangeSliderButton.h"

@interface XYRangeSliderButton ()

@property (nonatomic, weak) UIImageView * backgroundImageView;

@end

@implementation XYRangeSliderButton

- (instancetype)init {
    self = [super init];
    if (self) {
        [self xy_init];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.backgroundImageView.frame = self.backgroundImageView.superview.bounds;
}

- (void)xy_init {
    UIPanGestureRecognizer * recognizer = [[UIPanGestureRecognizer alloc] initWithTarget:nil action:nil];
    self.panGestureRecognizer = recognizer;
    [self addGestureRecognizer:recognizer];
    
    UIImageView * imageView = [[UIImageView alloc] init];
    imageView.layer.shadowColor = [UIColor blackColor].CGColor;
    imageView.layer.shadowOffset = CGSizeMake(0, 3);
    imageView.layer.shadowRadius = 2;
    imageView.layer.shadowOpacity = 0.3;
    imageView.contentMode = UIViewContentModeCenter;
    self.backgroundImageView = imageView;
    [self addSubview:imageView];
}

- (void)setBackgroundImage:(UIImage *)backgroundImage {
    self.backgroundImageView.image = backgroundImage;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
